/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kit.learning.listner;

import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 *
 * @author thilinaj
 */
public class SesionCounter implements HttpSessionListener{
    private static int count;
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        System.out.println("session create");
        count ++;
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        System.out.println("session distroy");
        count --;
    }

    public static int getCount() {
        System.out.println(count);
        return count;
    }
    
    public static String getTime(){
        Date d = Calendar.getInstance().getTime();
        
        DateFormat df = DateFormat.getDateInstance(DateFormat.FULL);
        //Date dd = df.
        return df.format(d);
    }
    
    
}
